<template>
  <div class="GetLocation">
    <img :src="require('@/assets/images/getLocationBg.jpg')" alt="">
  </div>
</template>

<script>
  export default {
    name: 'GetUserLocation',
    methods: {
      GetUserLocationInfo () {
        const THIS = this
        window.wx.getLocation({
          type: 'wgs84', // 默认为wgs84的gps坐标，如果要返回直接给openLocation用的火星坐标，可传入'gcj02'
          success: function (ResUserLocationInfo) {
            window.localStorage.setItem('UserLocationInfo', JSON.stringify(ResUserLocationInfo))
            THIS.$router.push({ name: 'StoreList' })
          }
        })
        THIS.$router.push({ name: 'StoreList' })
      }
    },
    mounted () {
      this.$nextTick(() => {
        this.GetUserLocationInfo()
      })
    }
  }
</script>

<style lang="less" scoped>
  .GetLocation {
    height: 100%;
    width:100%;
    img{
      width: 100%;
      height: 100%;
    }
  }
</style>
